#ifndef __NRF24l01_H__
#define __NRF24l01_H__

#include "nrf_spi.h"

#define nrfLink_id		3

enum Lock_Status
{
	nrf_lock   = 0,
	nrf_unlock = 1,
};

enum Fly_Mode
{
	attitude  = 0,
	height 		= 1, 
};

typedef struct _rxdata_t
{
	float thr;
	float yaw;
	float roll;
	float pitch;
	
	uint8_t uva_cal;
	enum Lock_Status lock;
	enum Fly_Mode mode;

}rxdata_t;

#define THR_MAX		100
#define ATT_MAX		20
#define THR_VAL	60
#define ATT_VAL 13

#define RX_DR									0x40
#define TX_OK									0x20
#define MAX_RT								0x10
#define NRF_CONFIG 0x00				 // 	配置寄存器
#define EN_AA 0x01 					// 			Auto Ack
#define EN_RXADDR 0x02 			// 		接受通道使能
#define SETUP_AW 0x03 // 'Setup address width' register address 
#define SETUP_RETR 0x04 // 'Setup Auto. Retrans' register address 
#define RF_CH 0x05 					// 	频率
#define RF_SETUP 0x06 				// 	射频配置
#define STATUS 0x07 // 'Status' register address 
#define OBSERVE_TX 0x08 // 'Observe TX' register address 
#define CD 0x09 // 'Carrier Detect' register address 
#define RX_ADDR_P0 0x0A // 'RX address pipe0' register address 
#define RX_ADDR_P1 0x0B // 'RX address pipe1' register address 
#define RX_ADDR_P2 0x0C // 'RX address pipe2' register address 
#define RX_ADDR_P3 0x0D // 'RX address pipe3' register address 
#define RX_ADDR_P4 0x0E // 'RX address pipe4' register address 
#define RX_ADDR_P5 0x0F // 'RX address pipe5' register address 
#define TX_ADDR 0x10 // 'TX address' register address 
#define RX_PW_P0 0x11 			// 	通道 0 有效数据宽度
#define RX_PW_P1 0x12 // 'RX payload width, pipe1' register address 
#define RX_PW_P2 0x13 // 'RX payload width, pipe2' register address 
#define RX_PW_P3 0x14 // 'RX payload width, pipe3' register address 
#define RX_PW_P4 0x15 // 'RX payload width, pipe4' register address 
#define RX_PW_P5 0x16 // 'RX payload width, pipe5' register address 
#define FIFO_STATUS 0x17 // 'FIFO Status Register' register address 
#define GET_DATA 0x61				//读取到的数据
#define GET_DATA_LEN 0x60		//读取到的数据位数
#define W_DATA 0xA0				//发送寄存器放数据

void nrf_updata(void);
void nrf_init(void);
void nrf_CheckGetFrequency(void);
void nrf_getFrequency(void);
extern rxdata_t rxdata;
#endif


